<template>
  <dv-capsule-chart class="rightCenter-content" :config="listCfg" v-if="pageFlag" style="width: 80%;margin: auto;height: 100%; "/>
  <reacquire v-else @click="getData"></reacquire>
</template>

<script>
import reacquire from '../../components/reacquire/reacquire.vue';
import {currentGET} from '../../api/modules' 
export default {
  components: { reacquire },
  data() {
    return {
      pageFlag:false,
      timer:null,
      listCfg:{
        data:[],
        showValue:true,
        unit:'万'
      }
    };
  },
  filters: {
    
  },
  created() {
    this.getData()
  },
  mounted() {
  },
  beforeDestroy() {
    if (this.timer) {
      clearInterval(this.timer)
      this.timer = null
    }
  },
  methods: {
    getData(){
      currentGET('big11').then(res=>{
        if (res.success) {
          this.listCfg={
            ...this.listCfg,
            data:res.data
          }
          this.pageFlag = true
          this.switper()
        }else{
          this.pageFlag = false
        }
      })
    },
    switper(){
      if(this.timer){
        return
      }
      this.timer = setInterval(()=>{
        this.getData()
      },this.$store.state.setting.echartsAutoTime)
    }
  },
};
</script>
<style lang='scss' scoped>
</style>